-
Couldn't load subscription status.
- Fork 8k
[RFC] Strict operators directive #4375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Strict operators have affect on arithmetic operators. Split mul, pow, and div functions into slow and fast function (similar to add and sub). Split mod function to part that does casting and part that expects longs.
`compare_function` calls either `standard_compare_function` or `strict_compare_function` Changed is equal / is not equal to call strict_is_equal_function Don't do smart string comparison in strict mode Updated zend_vm to use `is_equal_function` for IS_EQUAL and IS_NOT_EQUAL
Fixed side effects with comparison operators.
Including array equality.
Always use ZEND_CASE for case (checking OP1_TYPE to free). Don't use specific resource id in concatenation test.
Includes support for Spl objects like ArrayObject and SplObjectStorage.
…operators mode. (suggested by @nikic)
Can't be sure of the exact operator in some cases (like unary plus that uses ZEND_MUL).
| @@ -583,6 +586,10 @@ struct _zend_execute_data { | |||
| #define ZEND_RET_USES_STRICT_TYPES() \ | |||
| ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)) | |||
|
|
|||
| #define ZEND_USES_STRICT_OPERATORS() \ | |||
| ((EG(current_execute_data) && (EG(current_execute_data)->func->common.fn_flags & ZEND_ACC_STRICT_OPERATORS) != 0) || \ | |||
| (!EG(current_execute_data) && CG(active_op_array) && (CG(active_op_array)->fn_flags & ZEND_ACC_STRICT_OPERATORS) != 0)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that the common run-time case and the rare compile-time cases are combined here.
|
Closing as the linked RFC has been withdrawn and replaced by https://wiki.php.net/rfc/string_to_number_comparison with PR #3886. |
https://wiki.php.net/rfc/strict_operators